//
//  mm_tableView1Cell.m
//  HondaPro_2
//
//  Created by Eric on 13-7-17.
//  Copyright (c) 2013年 glendale. All rights reserved.
//

#import "mm_tableView1Cell.h"

@implementation mm_tableView1Cell

@synthesize arrForKeys = _arrForKeys;
@synthesize dicForLblsOnCell = _dicForLblsOnCell;

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        
        [self initLblsOnCell];
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(void)initLblsOnCell
{
    self.arrForKeys = [NSArray arrayWithObjects:
                       MM_ALLOCATION_STATEMENT_NUMBER_KEY_STR_,
                       MM_ALLOCATION_INDICATION_NUMBER_KEY_STR_,
                       MM_ALLOCATION_INDICATION_CONTENT_KEY_STR_,
                       MM_ALLOCATION_SERVICE_TYPE_KEY_STR_,
                       MM_ALLOCATION_REPAIR_MONEY_KEY_STR_,
                       MM_ALLOCATION_ALLOCATION_STATUS_KEY_STR_, nil];
    
    NSDictionary *dicForLblsRect = [NSDictionary dictionaryWithObjectsAndKeys:
                                    [NSValue valueWithCGRect:CGRectMake(0, 0, 85, 50)],MM_ALLOCATION_STATEMENT_NUMBER_KEY_STR_,
                                    [NSValue valueWithCGRect:CGRectMake(86, 0, 85, 50)],MM_ALLOCATION_INDICATION_NUMBER_KEY_STR_,
                                    [NSValue valueWithCGRect:CGRectMake(172, 0, 302, 50)],MM_ALLOCATION_INDICATION_CONTENT_KEY_STR_,
                                    [NSValue valueWithCGRect:CGRectMake(475, 0, 149, 50)],MM_ALLOCATION_SERVICE_TYPE_KEY_STR_,
                                    [NSValue valueWithCGRect:CGRectMake(625, 0, 149, 50)],MM_ALLOCATION_REPAIR_MONEY_KEY_STR_,
                                    [NSValue valueWithCGRect:CGRectMake(775, 0, 149, 50)],MM_ALLOCATION_ALLOCATION_STATUS_KEY_STR_, nil];
    
    self.dicForLblsOnCell = [NSMutableDictionary dictionaryWithCapacity:[_arrForKeys count]];
    
    for (int i = 0; i<[_arrForKeys count]; i++)
    {
        NSString *strKey = [_arrForKeys objectAtIndex:i];
        CGRect rect = (CGRect)[[dicForLblsRect objectForKey:strKey] CGRectValue];
        UILabel *lbl = [[UILabel alloc] initWithFrame:rect];
        lbl.backgroundColor = [UIColor clearColor];
        lbl.textColor = [UIColor grayColor];
        lbl.font = [UIFont systemFontOfSize:16];
        lbl.numberOfLines = 2;
        [self.dicForLblsOnCell setObject:lbl forKey:strKey];
        [self addSubview:lbl];
        
        if (0 == i)
        {
            lbl.textAlignment = UITextAlignmentCenter;
        }
    }
}

@end
